<?php
/** 
* @version $Id: controller.php 18 2009-12-07 11:22:56Z truongnhan0311 $ 
* @author truongnhan0311 * @package	wrd component */	

// no direct access	
defined( '_JEXEC' ) or die( 'Restricted' );	
$product_details = $this->product_details ;	
$list_images = $this->list_image ;?>	

<script type="text/javascript">		
	function pointIsOk(idEl , point, pointx, p_u){			if(((parseInt(pointx) > 0) && ( parseInt(p_u) < parseInt(pointx))) || ((parseInt(pointx) <= 0) && ( parseInt(p_u) < parseInt(point)))){ 				document.getElementById(idEl).style.display = 'block' ;				document.getElementById(idEl).innerHTML = "<img src='images/wrd/redeem_not_ok.png' />Sorry, You don't have enought points for this exchange !" ;			}else{				location.href = 'index.php?option=com_wrd&task=redemption.redeemtion&pid=<?php echo $this->product_details->id; ?>';			}		}	</script>													<div class="div_wrd_product_of_category" style="width:680px ;">		<br clear="right" />		<table  width="100%">			<tr>				<td class="a-left">					<div class="f-left" style="padding-bottom:3px;font-size:15px;"><label for="title"><?php echo $this->p_title ; ?></label></div>					<div class="f-right" style="padding-bottom:3px;font-size:15px;"><label for="title"> You have earned <span class='link_color'><?php echo $this->p_o_u ; ?> points</span></label></div>					<hr style="clear:both ;" />				</td>			</tr>			<tr>				<td>					<h2 class="arrow_left_bg"><?php echo "PRODUCT DETAILS"; ?></h2>				</td>			</tr>		</table>		<div id="redeem_mess"></div>		<?php if( !empty($product_details) && count($product_details) > 0) : ?>		<table style="width:100% ;">			<tr>				<td>					<div>						<?php if(count($list_images)>0):?>						<div class="f-left figure_images" style="margin-bottom:10px;margin-right:10px;">							<table cellpadding="2">								<tr>									<td>										<center>											<div id="main_figure_img">												<img border="0" src="wrd/image/<?php echo $list_images[0]->file_name; ?>" width = "220" height = "120"  />											</div>										</center>									</td>								</tr>								<tr>									<td>										<script type="text/javascript">											function changeFigureImg(val){												document.getElementById('main_figure_img').innerHTML = "<img src=wrd/image/"+val+" width=220 height=120 />";											}										</script>																				<?php 											$i = 0;											foreach($list_images as $list_image):										?>												<a href="#image<?php echo $i ; ?>" onclick = "changeFigureImg('<?php echo $list_image->file_name ; ?>')" ><img border="0" class="f-left" src=wrd/thumb/<?php echo $list_image->file_name ; ?> width="70" height="40" /></a>										<?php 												$i++;												endforeach;										?>									</td>								</tr>								</table>						</div>	<?php endif ; ?>						<div>							<table cellpadding="0" cellspacing="0">								<tr>									<td>										<table cellpadding="0" cellspacing="0">											<tr>												<td>													<b class="f-left"><?php echo $product_details->products_name; ?></b>												</td>												<td class="p-l-10">													<span class="link_color f-left"> - <?php echo $product_details->point ; ?> Points<?php if(!empty($product_details->pointx)){ echo "/".$product_details->pointx ;  ?> Points+<?php echo $product_details->cash ; ?> VND<?php } ?></span>												</td>												<?php if($product_details->quantity > 0): ?>												<td class="p-l-10">													<a onclick = "pointIsOk('redeem_mess','<?php echo $product_details->point ; ?>','<?php echo $product_details->pointx ; ?>','<?php echo $this->p_o_u ; ?>')" href="#redeem" class="redeem_bg f-left"><span> <?php echo "Redeem" ; ?></span></a>												</td>												<?php endif ; ?>											</tr>										</table>									</td>								</tr>							</table>							<div class="a-justify">								<?php 									if(!empty($product_details->des)){										echo $product_details->des;									}								?>							</div>						</div>						<br clear="both" />					</div>				</td>			</tr>		</table>		<?php 			else:		?>					<table class="tbl_pagination" style="width:100%;">					<tr>						<td>							<span class="c660000">There are have no details for this product.</span>						</td>					</tr>				</table>		<?php 			endif;		?>	</div>	<!-- Show products details -->		<!-- Show form redeem -->	<div class="div_wrd_product_of_category">		<br clear="right" />		<table class="tbl_wrd_tt_p_product_of_category">			<tr>				<td height="3">					<hr />				</td>			</tr>			<tr>				<td>					<h2 class="arrow_left_bg"><?php echo "Redeem"; ?></h2>				</td>			</tr>		</table>		<table class="tbl_wrd_tt_p_product_of_category">			<tr>				<td>					<center>						<span class="c660000" style="font-size: 20px;"><?php echo JText::_("Content of Redeem page"); ?></span>					</center>				</td>			</tr>		</table>		<table class="tbl_wrd_tt_p_product_of_category">			<tr>				<td height="3">					<hr />				</td>			</tr>		</table>	</div>